package com.deepocean.service.impl;

import com.deepocean.dao.HierarchicalCycloneDao;
import com.deepocean.entity.HierarchicalCycloneCondition;
import com.deepocean.entity.HierarchicalCycloneEntity;
import com.deepocean.entity.HierarchicalCycloneInAndOut1Hour;
import com.deepocean.service.IHierarchicalCycloneService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.UUID;

@Service
public class HierarchicalCycloneServiceImpl implements IHierarchicalCycloneService {
    @Autowired
    private HierarchicalCycloneDao hierarchicalCycloneDao;

    @Override
    public boolean add(HierarchicalCycloneEntity hierarchicalCycloneEntity) {
        String id = UUID.randomUUID().toString().replaceAll("-", "");
        hierarchicalCycloneEntity.setId(id);
        return hierarchicalCycloneDao.add(hierarchicalCycloneEntity);
    }

    @Override
    public HierarchicalCycloneInAndOut1Hour getInAndOutInHour(String deviceId) {
        return hierarchicalCycloneDao.getInAndOutInHour(deviceId);
    }

    @Override
    public List<HierarchicalCycloneEntity> getHierarchicalCycloneCondition(HierarchicalCycloneCondition hierarchicalCycloneCondition) {
        return hierarchicalCycloneDao.getHierarchicalCycloneByCondition(hierarchicalCycloneCondition);
    }
}
